<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>


      let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
      // arr = nums;
      let result = [];
      for (let i = 0; i < arr.length; i++) {
        for (let j = i + 1; j < arr.length; j++) {
          if (arr[i] + arr[j] == 7) {
            result.push([i, j]);
          }
        }
      }
      // return result;
      var params = "pages/index/index";
      let tabBars = ["home", "DIY", "pets", "mine"];
      const hasTabBar = tabBars.some((tab) => params.includes(tab));
      console.log(hasTabBar);


      // 链表实现
      class Node {
        constructor(val) {
          this.val = val;
          this.next = null;
        }
      }
      class LinkedList {
        constructor() {
          this.head = null;
        }

        push(val) {
          let node = new Node(val);
          if (!this.head) {
            this.head = node;
            return;
          } else {
            let current = this.head;
            while (current.next) {
              current = current.next;
            }
            current.next = node;
          }
        }
        deleteNode(val) {
          if (!this.head) return;
          if (this.head.val === val) {
            this.head = this.head.next;
          }
          let current = this.head;
          while (current.next && current.next.val !== val) {
            current = current.next;
          }
          if (!current.next) return;
          current.next = current.next.next;
        }
        printList() {
          let current = this.head;
          while (current) {
            console.log(current.val);
            current = current.next;
          }
        }
      }

      // 使用示例
      let list = new LinkedList();
      list.push(1);
      list.push(2);
      list.push(3);
      list.printList(); // 输出: 1, 2, 3
      list.deleteNode(2);
      list.printList(); // 输出: 1, 3
      console.log(list[0])
    </script>
  </body>
</html>
